import React, { Component } from 'react'
import { Provider } from './Context'
import Son from './Son'
import GrandSon from './GrandSon'
export default class Index extends Component {
  state = {
    money: 1000
  }

  render () {
    return (
      <div>
        <p>顶级组件--{this.state.money}</p>
        <hr />
        {/* value属性是固定的 */}
        <Provider value={this.state.money}>
          <Son />
          <GrandSon />
        </Provider>
      </div>
    )
  }
}
